﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>GroupAdminInfoList</title>
</head>
<body>
<form id="form1" name="form1" method="post" enctype="multipart/form-data">
<div class="easyui-layout" data-options="fit:true,">
    <div data-options="region:'north',split:false,border:false," class="nowrap" style="height: 27px; overflow: hidden;">
        <div style="float: left;">
            <a href="javascript:void(0)" class="easyui-linkbutton mp0" id="InfoNew" data-options="iconCls:'icon-add1',plain:true,">新建</a>
            <a href="javascript:void(0)" class="easyui-linkbutton mp0" id="InfoRep" data-options="iconCls:'icon-redo',plain:true,">回复</a>
            <a href="#" class="easyui-menubutton" data-options="menu:'#mm2',iconCls:'icon-edit',"></a>
            <div id="mm2" style="width: 150px;">
                <div id="InfoView">阅读（双击）</div>
                <div id="InfoEdit">编辑</div>
                <div>移动</div>
                <!--<div>剪切</div>
                <div>复制</div>
                <div>粘贴</div>
                <div class="menu-sep"></div>
                <div data-options="iconCls:'icon-undo'">撤消</div>
                <div data-options="iconCls:'icon-redo'">恢复</div>-->
                <div class="menu-sep"></div>
                <div data-options="iconCls:'icon-cancel'">删除</div>
                <div data-options="iconCls:'icon-stop'">停止</div>
                <div class="menu-sep"></div>
                <div id="SelectMoreNo">禁止多选</div>
                <div id="SelectMoreYes">允许多选</div>
                <div class="menu-sep"></div>
                <div id="SortNo">禁止拖动排序</div>
                <div id="SortYes">允许拖动排序</div>
                <div class="menu-sep"></div>
                <div id="SortSave">[本页全部] 保存顺序</div>
                <div id="SortClear">[对选定的] 清除顺序</div>
                <div id="SortAdd">[对选定的] 加入排序</div>
            </div>
        </div>
        <div style="float: right; padding: 2px 1px 0px 2px;">
            <input class="easyui-searchbox" data-options="prompt:'',menu:'#mmx',searcher:window.xbase.doSearch," style="width: 100px;" />
            <div id="mmx" style="display: none;">
                <div data-options="name:'node',plain:true,">节点</div>
                <div data-options="name:'info',plain:true,">内容</div>
            </div>
        </div>
    </div>
    <div data-options="region:'center',border:true," style="padding: 1px; overflow: hidden;">
        <table id="datagrid1" class="easyui-datagrid" style="width: 100%; height: 100%; overflow: hidden;" data-options="title:'留言内容列表',iconCls:'icon-group',rownumbers:true,pagination:true,singleSelect:true,
            method:'post',autoRowHeight:true,toolbar:'#tbs',onLoadSuccess:function(){/*$(this).datagrid('enableDnd');*/},">
            <thead>
                <tr>
                    <th data-options="field:'ck',checkbox:true,"></th>
                    <th data-options="field:'NodeId',halign:'center',">NodeId</th>
                    <th data-options="field:'PkId',halign:'center',">PkId</th>
                    <th data-options="field:'Tag',halign:'center',">所属节点</th>
                    <th data-options="field:'Title',halign:'center',">主标题</th>
                    <th data-options="field:'DateTimeCreate',halign:'center',formatter:window.xbase.FormatDateTime,">时间</th>
                    <th data-options="field:'count',halign:'center',formatter:window.xbase.FormatReply,">是否回复</th>
                    <th data-options="field:'FlagView',halign:'center',formatter:window.xbase.FormatFlagView,">是否显示</th>
                    <th data-options="field:'FlagPass',halign:'center',formatter:window.xbase.FormatFlagPass,">状态</th>
                </tr>
            </thead>
        </table>
    </div>
</div>
</form>
<script type="text/javascript">
    $(function () {
        window.xbase.logonNo(); // 访问本页面，如已登录则跳转到index.html。
        $('#datagrid1').datagrid({ url: '/Ashx/Acc/Staff/BookAdminInfoList.ashx?' + window.xbase.urlparas });
        $('#InfoView').click(function () {
            if (!window.xbase.checkDataGridItem('#datagrid1')) return;
            $('#Action').attr('value', 'ActView');
            $('#dialog1').dialog({
                title: '内容管理·查看',
                iconCls: 'icon-word',
                method: 'get',
                closed: false,
                cache: false,
                href: '/Html/Acc/Staff/GroupAdminInfoView.html?' + window.xbase.urlparas,
                modal: true,
                success: function (result) {
                    alert(result);
                }
            });
        });
        $('#datagrid1').datagrid({
            onDblClickRow: function (index, field, value) {
                $('#Action').attr('value', 'ActView');
                $('#datagrid1').datagrid('clearSelections');   //清除所有
                $('#datagrid1').datagrid('selectRow', index);  //选择当前
                $('#dialog1').dialog({
                    title: '详细信息',
                    iconCls: 'icon-word',
                    method: 'get',
                    closed: false,
                    cache: false,
                    href: '/Html/Acc/Staff/GroupAdminInfoView.html?' + window.xbase.urlparas,
                    modal: true,
                    success: function (result) {
                        alert(result);
                    }
                });
            }
        });
        $('#InfoNew').click(function () {
            $('#Action').attr('value', 'ActNew');
            $('#dialog1').dialog({
                title: '内容管理·新建',
                iconCls: 'icon-word',
                method: 'get',
                closed: false,
                cache: false,
                href: '/Html/Acc/Staff/GroupAdminInfoForm.html?' + window.xbase.urlparas,
                modal: true,
                success: function (result) {
                    alert(result);
                }
            });
        });
        $('#InfoRep').click(function () {
            if (!window.xbase.checkDataGridItem('#datagrid1')) return;
            $('#Action').attr('value', 'ActReply');
            $('#dialog1').dialog({
                title: '内容管理·回复',
                method: 'get',
                closed: false,
                cache: false,
                href: '/Html/Acc/Staff/GroupAdminInfoForms.html?' + window.xbase.urlparas,
                modal: true,
                success: function (result) {
                    alert(result);
                }
            });
        });
        $('#InfoEdit').click(function () {
            if (!window.xbase.checkDataGridItem('#datagrid1')) return;
            $('#Action').attr('value', 'ActEdit');
            $('#dialog1').dialog({
                title: '内容管理·修改',
                method: 'get',
                closed: false,
                cache: false,
                href: '/Html/Acc/Staff/GroupAdminInfoForm.html?' + window.xbase.urlparas,
                modal: true,
                success: function (result) {
                    alert(result);
                }
            });
        });
        $('#SelectMoreYes').click(function () { $('#datagrid1').datagrid({ singleSelect: false, }); });
        $('#SelectMoreNo').click(function () { $('#datagrid1').datagrid({ singleSelect: true, }); });
        $('#SortYes').click(function () {
            if (!window.xbase.checkTreeViewNode('#treeview1')) return;
            if (!window.xbase.checkTreeViewLeaf('#treeview1')) return;
            $("#datagrid1").datagrid('enableDnd');
        });
        $('#SortNo').click(function () { $("#datagrid1").datagrid('reload'); });
        $('#SortSave').click(function () {
            var opts = $('#datagrid1').datagrid('getPager').data("pagination").options;
            if (opts.pageNumber != 1) {
                $.messager.alert("提示信息", "仅限在第1页排序。对其它页排序，可以：<br />(1)增加每页条数，使排序对象在第一页。<br />(2)选中对象，点下拉菜单“加入排序”。", 'info');
                return;
            }
            if (!window.xbase.checkTreeViewNode('#treeview1')) return;
            if (!window.xbase.checkTreeViewLeaf('#treeview1')) return; //排序需要选中末级节点
            var rows = $('#datagrid1').datagrid("getRows");
            var arrs = new Array();
            for (var i = 0; i < rows.length; i++) arrs.push(rows[i].PkId);
            arrs.join();
            SortAction('save', arrs);
        });
        $('#SortClear').click(function () { SortSelect('clear'); });
        $('#SortAdd').click(function () { SortSelect('add'); });
        function SortSelect(act) {
            if (!window.xbase.checkDataGridItems('#datagrid1')) return;
            var rows = $('#datagrid1').datagrid("getChecked");
            var arrs = new Array();
            for (var i = 0; i < rows.length; i++)
                arrs.push(rows[i].PkId);
            arrs.join();
            SortAction(act, arrs);
        }
        function SortAction(act, objs) {
            $('#form1').form('submit', {
                url: '/Ashx/Acc/Staff/GroupAdminInfoListSort.ashx?act=' + act + '&rows=' + objs,
                success: function (result) {
                    if (!(result != null && result != '')) return window.xbase.return('系统错误', 'Ajax返回空值，请稍后重试！<br />ps:如果您使用了360浏览器，请换之！', 'error');
                    var json = window.xbase.json(result);
                    $.messager.alert(json.title, json.message.m_StringValue, 'info');
                    $("#datagrid1").datagrid('reload');
                },
            });
        }
    });
</script>
</body>
</html>
